package cn.net.shuxing.yifu.common.service;

import cn.net.shuxing.yifu.common.bean.ShareholderBonusList;
import cn.net.shuxing.yifu.common.mapper.ShareholderBonusListMapper;
import cn.net.shuxing.yifu.common.util.CommonExample;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.common.Mapper;
import tk.mybatis.mapper.entity.Example;

import java.util.List;


@Service
public class ShareholderBonusListService extends BaseService<ShareholderBonusList, ShareholderBonusListMapper> {

    public ShareholderBonusList getByKey(String bonusKey) {
        CommonExample example = new CommonExample(ShareholderBonusList.class);
        example.equals("bonusKey", bonusKey);
        return getByExample(example);
    }

    public Integer getMaxId() {
        Example example = new Example(ShareholderBonusList.class);
        example.setOrderByClause("id DESC");
        List<ShareholderBonusList> shareholderBonusLists = mapper.selectByExample(example);
        Integer maxId = 0;
        if (shareholderBonusLists == null || shareholderBonusLists.isEmpty()) {
        } else {
            maxId = shareholderBonusLists.get(0).getId();
        }
        return maxId;
    }
}
